package cn.edu.scau.cmi.dengzhengyu.comprehensiveExperiment;

import cn.edu.scau.cmi.dengzhengyu.multiton.Chairmans;
import cn.edu.scau.cmi.dengzhengyu.singleton.Chairman;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;

public class MultitonUIController {

    @FXML
    private TableColumn<cn.edu.scau.cmi.dengzhengyu.multiton.Chairmans, String> TableColumn1;

    @FXML
    private Button Btn1;

    @FXML
    private TextField Text1;

    @FXML
    private TableView<cn.edu.scau.cmi.dengzhengyu.multiton.Chairmans> TableView1;

    @FXML
    private Button Btn2;
    
    
    @FXML
    void onBtn1Clicked(ActionEvent event) {
    	TableColumn1.setCellValueFactory(new PropertyValueFactory<Chairmans, String>("name"));
    	TableView1.getItems().add(Chairmans.getInstance(Text1.getText()));
    }
    
    @FXML
    void onBtnClick2(ActionEvent event) {
    	TableColumn1.setCellValueFactory(new PropertyValueFactory<Chairmans, String>("name"));
    	TableView1.getItems().add(Chairmans.getInstance(""));
    }

}
